package com.best.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 口味
 *
 * @author yangruyi
 * @date 2021/3/11
 */
public enum TasteType {
    /**
     * 正常
     */
    NORMAL(0),
    /**
     * 清淡
     */
    LIGHT(1),
    /**
     * 浓郁(真香！)
     */
    RICH(2);

    @EnumValue
    @JsonValue
    private final int code;

    TasteType(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public static TasteType getInstance(int code){
        for (TasteType value : TasteType.values()) {
            if(code == value.code){
                return value;
            }
        }
        return null;
    }
}
